<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp"%>
<%@ page import="com.chanyachting.emall.util.*" %>
<%@ page import="java.util.*" %>

<%@ page import="com.chanyachting.emall.domain.*" %>
<%@ page import="com.chanyachting.emall.util.RequestUtil" %>
<%@ page import="com.chanyachting.emall.service.*" %>
<%@ page import="com.chanyachting.emall.serviceImpl.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<link href="css/import.css" type="text/css" rel="stylesheet" />
<title>挑选新闻活动</title>

<%

	//获得期刊编号
	RequestUtil ru=new RequestUtil(request);

	String pid=ru.getParameter("id","0");

%>

<script type="text/javascript" src="<%=root %>/js/jquery-1.3.2.min.js" charset="utf-8">//ADCRM</script>

<script type="text/javascript">

	$(function(){
		
		$.ajaxSetup ({
		    cache: false //关闭AJAX相应的缓存
		});
		
	});


	function getAllcheckedMenu(){

		 var r=document.getElementsByName("naId");

		 var menuArray="";  

		 var haschecked=false;
		 
	    for(var i=0;i<r.length;i++){
		    
	         if(r[i].checked){

		         haschecked=true;

		         var id=r[i].id;
		         var text=r[i].nextSibling.nodeValue;
		         
			   	menuArray+=id+",";
			
	       }
	    }

	    if(!haschecked){

		   alert("请选择菜单！");

			return false;
		}

	    menuArray=menuArray.substr(0,menuArray.length-1);


	    $.get("<%=root%>/adminBackend/periodical.do?method=savePNews", { menuArray: menuArray,pid:"<%= pid%>"  },
				  function(data){
				    alert("操作成功！");
				  });



	}

</script>

</head>

<body>
<div class="tab_box">
	<div class="tab_menu">
    	<a href="#" class="current">新闻活动列表</a>
    </div>
	
</div>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="yes_border">
 
  <tr>
    <td colspan="5" align="center" bgcolor="#E7E7E7"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" align="center"></td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <th  align="center">--</th>
    <th  align="center">新闻标题</th>
    <th  align="center">新闻作者</th>
    <th  align="center">新闻创建时间</th>
    <th  align="center">新闻发布时间</th>
  </tr>
  
  <%
  
  
  	List list=(List)new RequestUtil(request).getAttribute("newsactivityList",new ArrayList());
  
  	Newsactivity na =null;
  
  	if(list!=null && list.size()>0){
  		
  		for(int i=0;i<list.size();i++){
  			
  			na=(Newsactivity)list.get(i);
  			
  			String temp="";
  			
  			if(na.getPeriodical()!=null && na.getPeriodical().equals(pid)){
  				
  				temp="checked";
  			}else temp="";
  %>
  <tr>
  <form name="<%=i %>" action="" method="post">
  
    <td align="center">
    	<input type="checkbox" name="naId" id="<%= na.getId() %>"  <%= temp %> value="" />
    </td>
    <td align="center"><%= na.getTitle()  %></td>
    <td align="center"><%= na.getAuthor() %></td>
    
    <td align="center"><%= na.getCreateDate() %></td>
    <td align="center"><%= na.getReleaseDate() %></td>
    
   </form>
  </tr>
  
  <%
  			
  		}

  	}
  
  %>
  
  <tr>
  	<td colspan="5"> <button onclick="getAllcheckedMenu();">确定</button> </td>
  </tr>
 
 
  <tr>
    <td colspan="5" bgcolor="#E7E7E7"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" align="center"></td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center"></td>
      </tr>
    </table></td>
  </tr>
 
</table>
<p>&nbsp;</p>
</body>
</html>

